<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
            $table->string('goods_sn', 50)->nullable();
            $table->string('gname', 50)->unique();
            $table->integer('bid')->index();
            $table->integer('sid')->index();
            $table->float('price', 9, 2)->index();
            $table->string('unit', 10)->nullable();
            $table->integer('salse')->default(0);
            $table->integer('click')->default(0);
            $table->string('pic', 255)->nullable();
            $table->integer('launch_time');
            $table->integer('drop_time')->nullable();
            $table->tinyInteger('is_member_price')->default(1);
            $table->integer('score')->default(0);
            $table->tinyInteger('state')->default(0);

            $table->string('attr1' ,50)->nullable();
            $table->string('attr2' ,100)->nullable();
            $table->string('attr3' ,150)->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods');
    }
}
